﻿@model Web
@{
    Layout = "~/Views/Shared/_LayoutPartial.cshtml";
    ViewBag.ImageUrl = "~/content/images/add_page_48x48.png";
    ViewBag.Title = Html.Global("SetupMySite_Title");
}
@Ajax.Dna().WidgetZone("Top zone", "zone1").GetHtml()
@using (Html.BeginForm())
{
    <div>
        @Html.ValidationSummary()
    </div>
    <input name="Web.Owner" value="@User.Identity.Name" type="hidden" />
    <input name="Web.Name" value="@User.Identity.Name" type="hidden" />
    <div style="padding: 30px;">
        <div id="title_field">
            <h4>
                <label for="Web_Title">
                    @Html.Global("RES_TITLE") - @Html.Global("RES_PAGE_TITLE_TIPS")
                </label>
            </h4>
            @(Ajax.DnaFor().TextBox(m => m.Title)
                           .Value(User.Identity.Name)
                           .Width(400)
                           .IconImageUrl(Url.Content("~/Content/Images/icon_home_16.png"))
                           .GetHtml()
            )
        </div>
        <div>
            <h4>
                <label for="Web_Theme">
                    @Html.Global("RES_THEME")
                </label>
            </h4>
            @(Ajax.Dna().ComboBox("Web.Theme")
                    .Bind(WebSiteContext.Current.DataContext.Themes.All().Select(p => p.Name).ToArray())
                    .Select("default")
                    .DropDownList()
                    .GetHtml())
        </div>
        <div id="desc_field">
            <h4>
                <label for="Web_Description">
                    @Html.Global("RES_DESC")
                </label>
            </h4>
            @Ajax.DnaFor().TextArea(m => m.Description).Width(400).GetHtml()
        </div>
        <div>
            <h4>
                @Html.Global("RES_WEBTEMPL")</h4>
            <table>
                <tr>
                    <td style="width:250px;">
                        @(
 Ajax.Dna().ListBox("solution")
 .Items(items =>
 {
     var pkgs = (IEnumerable<Package>)ViewBag.Templates;
     foreach (var pkg in pkgs)
     {
         items.Add(new NavigableData()
         {
             Title = pkg.Title,
             ToolTip = pkg.Description,
             Value = pkg.Name,
         });
     }
 })
        .Options(opts =>
        {
            opts.OnItemSelected = "$(\"#pkgDetail\").html($(ui.item).children(\".d-hidden\").html())";
        })
        .ItemTemplate(@<text> <span>@GE.GetContent(item.Title)</span>
                        <div style="display: none;" class="d-hidden">
                            @(MvcHtmlString.Create(GE.GetContent(item.Description)))
                        </div>
                        </text>)
                    .Select("Blog")
                    .GetHtml()
   )
                    </td>
                    <td id="pkgDetail" style="vertical-align: top; padding-left: 5px;">
                    </td>
                </tr>
            </table>
        </div>
        <hr />
        <div style="padding: 10px;text-align:center;">
            @(
 Ajax.Dna().Button()
                  .LocText("RES_CREATE")
                  .Submit()
                  .ImageIcons(Url.Content("~/content/images/icon_home_accept_16.png"))
                  .GetHtml()
                  )
        </div>
    </div>
}
